<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <style>
        input[type="text"]:enabled{background-color: blue;
            
        }
        input[type="text"]:disabled{
            background-color: blueviolet;
        }
        </style>

    </head>
    <body>
        <script>
        function radio_change(){
            var radio1=document.getElementById("radio1");
            var radio=document.getElementById("radio2");
            var text=document.getElementById("text");
            if(radio1.checked){
                text.disabled="";
            }
            else{
                text.value="";
                text.disabled="disabled"
            }
        }
        </script>
        <input type="radio" name="radio" id="radio1" onchange="radio_change()">可用
        <input type="radio" name="radio" id="radio2" onchange="radio_change()">不可用
        <input type="text" id="text" disabled>
    </body>
</html>